/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import {
    global,
    passNode,
    passNodeArray,
    unpackNonNullableNode,
    unpackNode,
    unpackNodeArray,
    assertValidPeer,
    AstNode,
    Es2pandaAstNodeType,
    KNativePointer
} from "../../reexport-for-generated"

import { Identifier } from "./Identifier"
import { Expression } from "./Expression"
import { ReturnStatement } from "./ReturnStatement"
import { TSTypeParameterDeclaration } from "./TSTypeParameterDeclaration"
import { TypeNode } from "./TypeNode"
import { Es2pandaScriptFunctionFlags } from "./../Es2pandaEnums"
import { AnnotationUsage } from "./AnnotationUsage"
export class ScriptFunction extends AstNode {
     constructor(pointer: KNativePointer) {
        assertValidPeer(pointer, 59)
        super(pointer)
        console.warn("Warning: stub node ScriptFunction")
    }
    get idConst(): Identifier | undefined {
        return unpackNode(global.generatedEs2panda._ScriptFunctionIdConst(global.context, this.peer))
    }
    get id(): Identifier | undefined {
        return unpackNode(global.generatedEs2panda._ScriptFunctionId(global.context, this.peer))
    }
    get paramsConst(): readonly Expression[] {
        return unpackNodeArray(global.generatedEs2panda._ScriptFunctionParamsConst(global.context, this.peer))
    }
    get params(): readonly Expression[] {
        return unpackNodeArray(global.generatedEs2panda._ScriptFunctionParams(global.context, this.peer))
    }
    get returnStatementsConst(): readonly ReturnStatement[] {
        return unpackNodeArray(global.generatedEs2panda._ScriptFunctionReturnStatementsConst(global.context, this.peer))
    }
    get returnStatements(): readonly ReturnStatement[] {
        return unpackNodeArray(global.generatedEs2panda._ScriptFunctionReturnStatements(global.context, this.peer))
    }
    get typeParamsConst(): TSTypeParameterDeclaration | undefined {
        return unpackNode(global.generatedEs2panda._ScriptFunctionTypeParamsConst(global.context, this.peer))
    }
    get typeParams(): TSTypeParameterDeclaration | undefined {
        return unpackNode(global.generatedEs2panda._ScriptFunctionTypeParams(global.context, this.peer))
    }
    get bodyConst(): AstNode | undefined {
        return unpackNode(global.generatedEs2panda._ScriptFunctionBodyConst(global.context, this.peer))
    }
    get body(): AstNode | undefined {
        return unpackNode(global.generatedEs2panda._ScriptFunctionBody(global.context, this.peer))
    }
    get returnTypeAnnotationConst(): TypeNode | undefined {
        return unpackNode(global.generatedEs2panda._ScriptFunctionReturnTypeAnnotationConst(global.context, this.peer))
    }
    get returnTypeAnnotation(): TypeNode | undefined {
        return unpackNode(global.generatedEs2panda._ScriptFunctionReturnTypeAnnotation(global.context, this.peer))
    }
    get isEntryPointConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsEntryPointConst(global.context, this.peer)
    }
    get isGeneratorConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsGeneratorConst(global.context, this.peer)
    }
    get isAsyncFuncConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsAsyncFuncConst(global.context, this.peer)
    }
    get isAsyncImplFuncConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsAsyncImplFuncConst(global.context, this.peer)
    }
    get isArrowConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsArrowConst(global.context, this.peer)
    }
    get isOverloadConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsOverloadConst(global.context, this.peer)
    }
    get isExternalOverloadConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsExternalOverloadConst(global.context, this.peer)
    }
    get isConstructorConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsConstructorConst(global.context, this.peer)
    }
    get isGetterConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsGetterConst(global.context, this.peer)
    }
    get isSetterConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsSetterConst(global.context, this.peer)
    }
    get isExtensionAccessorConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsExtensionAccessorConst(global.context, this.peer)
    }
    get isMethodConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsMethodConst(global.context, this.peer)
    }
    get isProxyConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsProxyConst(global.context, this.peer)
    }
    get isStaticBlockConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsStaticBlockConst(global.context, this.peer)
    }
    get isEnumConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsEnumConst(global.context, this.peer)
    }
    get isHiddenConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsHiddenConst(global.context, this.peer)
    }
    get isExternalConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsExternalConst(global.context, this.peer)
    }
    get isImplicitSuperCallNeededConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsImplicitSuperCallNeededConst(global.context, this.peer)
    }
    get hasBodyConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionHasBodyConst(global.context, this.peer)
    }
    get hasRestParameterConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionHasRestParameterConst(global.context, this.peer)
    }
    get hasReturnStatementConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionHasReturnStatementConst(global.context, this.peer)
    }
    get hasThrowStatementConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionHasThrowStatementConst(global.context, this.peer)
    }
    get isThrowingConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsThrowingConst(global.context, this.peer)
    }
    get isRethrowingConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsRethrowingConst(global.context, this.peer)
    }
    get isDynamicConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsDynamicConst(global.context, this.peer)
    }
    get isExtensionMethodConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionIsExtensionMethodConst(global.context, this.peer)
    }
    get flagsConst(): Es2pandaScriptFunctionFlags {
        return global.generatedEs2panda._ScriptFunctionFlagsConst(global.context, this.peer)
    }
    get hasReceiverConst(): boolean {
        return global.generatedEs2panda._ScriptFunctionHasReceiverConst(global.context, this.peer)
    }
    get annotations(): readonly AnnotationUsage[] {
        return unpackNodeArray(global.generatedEs2panda._ScriptFunctionAnnotations(global.context, this.peer))
    }
    get annotationsConst(): readonly AnnotationUsage[] {
        return unpackNodeArray(global.generatedEs2panda._ScriptFunctionAnnotationsConst(global.context, this.peer))
    }
}
export function isScriptFunction(node: AstNode): node is ScriptFunction {
    return node instanceof ScriptFunction
}